<template>
	<!-- 更换绑定手机号 -->
	<view>
		<view class="" style="padding: 26rpx 30rpx 0rpx ;">
			<view class="" style="padding-bottom: 36rpx;">
				<x-cell :leftslot="true">
					<view class="d-flex" slot="lefttext">
						<view class="" style="margin-right: 38rpx;">
							电话号码
						</view>
						<view class="" style=" ">
							<input type="number" v-model="phonenum" />
						</view>
					</view>
				</x-cell>
			</view>
			<!-- <u-line color="info" border-style="solid" /> -->
			<!-- <view class="" style="padding: 26rpx 0rpx 34rpx;">
				<x-cell :leftslot="true" :rightslot="true">
					<view class="d-flex" slot="lefttext">
						<view class="" style="margin-right: 38rpx;">
							验证码
						</view>
						<view class="" style="color: #B7B7B7;">
							<input type="text" v-model="codevalue" />
						</view>
					</view>
					<view class=" d-flex-yCenter-ju textColor-white " slot="righttext" style="width: 75px;height: 30px;
						background: #FF890B;border-radius: 6px;font-size: 24rpx;" @click="codenum">
						<view class="" v-if="code">
							获取验证码
						</view>
						<view class="" v-if="!code">
							{{time}}
						</view>
					</view>
				</x-cell>
			</view> -->
			<u-line color="info" border-style="solid" />

			<view class="" style="color: #989898;margin-top: 30rpx;font-size: 24rpx;">
				温馨提示：为了您的账号安全，您需要验证新手机号进行绑定，点击获取验证码可以收到有验证码的短信
			</view>
			<view class="" style="margin-top: 106rpx;">
				<x-button title="绑定" bgColor="#B7B7B7" @btnClick="getTophone"></x-button>
			</view>
		</view>
	</view>
</template>
<script>
	import {
		save
	} from '@/config/apiRouter.js'
	export default {
		data() {
			return {
				phonenum: '',
			}
		},

		onLoad(options) {
			this.phonenum = options.phonenum;
			console.log(options.phonenum, '收记号')
		},
		methods: {
			getTophone() {
				if (this.phonenum.length != 11) {
					uni.showToast({
						title: '请输入11位手机号',
						icon: 'error'
					})
					return;
				}
				save({
					phone: this.phonenum,
				}).then(res => {
					uni.showToast({
						title: res.msg,
						icon: 'none'
					})
					this.$tool.codeStatus.apply(this)
					uni.switchTab({
						url: '../../pages/my/my'
					})
				})

			}

		}
	}
</script>

<style>

</style>
